package computacaografica;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Extras extends JFrame {

	private static final long serialVersionUID = 1L;

	private JPanel painelA, painelB, painelC, painelD;
	private JLabel labelA, labelB, labelC, labelD;

	private GraficoPizza pizza;
	private GraficoColunas colunas;
	private GraficoBarras barras;
	private Legenda legenda;

	private final int LARG_GRAF = 200;
	private final int ALT_GRAF = 200;

	public Extras(int[] dados, String[] nomes) {
		pizza = new GraficoPizza(dados, this.LARG_GRAF, this.ALT_GRAF);
		colunas = new GraficoColunas(dados, this.LARG_GRAF, this.ALT_GRAF, 5);
		barras = new GraficoBarras(dados, this.LARG_GRAF, this.ALT_GRAF, 5);
		legenda = new Legenda(nomes, this.LARG_GRAF, this.ALT_GRAF);
		this.initComponents();
	}

	private void initComponents() {
		this.setTitle("Estatisticas");
		this.getContentPane().setLayout(null);
		this.painelA = new JPanel();
		this.labelA = new JLabel(pizza.getImage());
		this.painelA.add(labelA);
		this.getContentPane().add(this.painelA);
		this.painelA.setBounds(10, 20, this.LARG_GRAF, this.ALT_GRAF + 10);

		this.painelB = new JPanel();
		this.labelB = new JLabel(colunas.getImage());
		this.painelB.add(labelB);
		this.getContentPane().add(painelB);
		this.painelB.setBounds(20 + this.LARG_GRAF, 20, this.LARG_GRAF,
				this.ALT_GRAF + 10);

		this.painelC = new JPanel();
		this.labelC = new JLabel(barras.getImage());
		this.painelC.add(labelC);
		this.getContentPane().add(painelC);
		this.painelC.setBounds(30 + 2 * this.LARG_GRAF, 20, this.LARG_GRAF,
				this.ALT_GRAF + 10);

		this.painelD = new JPanel();
		this.labelD = new JLabel(legenda.getImage());
		this.painelD.add(labelD);
		this.getContentPane().add(painelD);
		this.painelD.setBounds(10, 240, this.LARG_GRAF, this.ALT_GRAF);

		Dimension d = new Dimension(650, 480);
		this.setSize(d);
		this.setPreferredSize(d);
		this.setResizable(false);
		this.pack();
		this.setVisible(true);
	}
}
